import Vue from 'vue'
import VueRouter from 'vue-router'
import VueCookie from 'vue-cookie'

import ReturnOrder from "../views/ReturnOrder";
import TraderIndex from "../views/TraderIndex";
import AddReturnOrder from "../views/addReturnOrder";
import UpdateReturnOrder from "../views/updateReturnOrder";
import TraderLogin from "../views/TraderLogin";
import Index from "../views/Index";
import StaffLogin from "../views/StaffLogin";
import StaffIndex from "../views/StaffIndex";
import Trader from "../views/Trader";
import AddTrader from "../views/AddTrader";
import UpdateTrader from "../views/UpdateTrader";
import DeleteTrader from "../views/DeleteTrader";
import RetailForTrader from "../views/RetailForTrader";

Vue.use(VueRouter)
Vue.use(VueCookie)

const routes = [
  {
    path:'/',
    component: Index,
    show:false
  },
  {
    path: '/traderLogin',
    component: TraderLogin,
    show:false
  },
  {
    path: '/staffLogin',
    component: StaffLogin,
    show: false
  },
  {
    path: '/TraderIndex',
    name: '订单管理',
    component: TraderIndex,
    redirect: 'RetailForTrader',
    isTrader: true,
    children: [
      {
        path: '/RetailForTrader',
        name: '订单详情',
        component: RetailForTrader,
        show: true
      },
      {
        path: '/returnOrder',
        name: '退货',
        component: ReturnOrder,
        show:true
      },
      {
        path: '/addReturnOrder',
        name: '添加退货',
        component: AddReturnOrder,
        show: false
      },
      {
        path: '/updateReturnOrder',
        name: '修改退货',
        component: UpdateReturnOrder,
        show: false
      }
    ]
  },
  {
    path: '/StaffIndex',
    name: '经销商管理',
    component: StaffIndex,
    redirect: 'trader',
    isStaff: true,
    children: [
      {
        path: '/trader',
        name: '经销商',
        component: Trader,
        show: true
      },
      {
        path: '/addTrader',
        name: '分配账号',
        component: AddTrader,
        show:true
      },
      {
        path:'/UpdateTrader',
        name:'更新账号',
        component: UpdateTrader,
        show: false
      },
      {
        path:'/deleteTrader',
        name:'批量删除',
        component: DeleteTrader,
        show: true
      },
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router